﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WpfBluetooth.ViewModel;

namespace WpfBluetooth
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        /// <summary>
        /// 数据
        /// </summary>
        MainWindowModel mode {  get; set; }
        public MainWindow()
        {
            InitializeComponent();

            mode=this.DataContext as MainWindowModel;
            mode.AddBlueTooth = new Action<BluetoothMode>(AddBlueToothMethod);
        }
        private void AddBlueToothMethod(BluetoothMode addmode)
        {
            this.Dispatcher.BeginInvoke(new Action(() => { mode.BluetoothList.Add(addmode); }));
          
        }
    }
}